import java.util.Scanner;
import java.util.ArrayList;
public class PP57
{
public static void main(String[] args)
{
String man, com,another = "y";
int x=0;//man win
int y=0;//computer win
int z=0;//dogfall
int num;

while (another.equalsIgnoreCase("y"))
{
Scanner scan = new Scanner(System.in);
System.out.println("Your choice: ");
man = scan.nextLine();

ArrayList<String> game = new ArrayList<String>();

game.add("r");//rock
game.add("s");//scissors
game.add("p");//paper

num = (int)(Math.random()*3);
 com = game.get(num);
System.out.println("Computer's choice: " + com);

if (man.equals(com))
{System.out.print("Dogfall");
z++;
}
else
{if(man.equals("r")||man.equals("s")||man.equals("p"))
{
if(man.equals("r")&&com.equals("s")||man.equals("s")&&com.equals("p")||man.equals("p")&&com.equals("r"))
{System.out.println("Man win");
x++;
}
else
{System.out.println("Computer win");
y++;
}
}
}
System.out.println("Continue (y/n)?");
another = scan.nextLine();}

System.out.println("Man win: " + x +"\n" + "Computer win: " + y + "\n" + "Dogfall" + z);
}
}
